﻿using System;
using System.Data;

namespace wuliuback
{
    public partial class ModifyUserPassword : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            string user_id = Request["user_id"];
            string password = Request["password"];

            string mdtPw = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5").ToLower().Substring(8, 16);

            string code = "";
            string msg = "";

            String sql = "";
            DbHelper dbHelper = new DbHelper();
            sql = "update t_user set password='"+mdtPw+"' "
                + " where user_id='" + user_id + "'";
            if (dbHelper.Update(sql))
            {
                code = "0";
                msg = "成功";
            }
            else
            {
                code = "-1";
                msg = "失败";
            }
            Response.Output.WriteLine("{\"code\":\"" + code + "\",\"msg\":\"" + msg + "\"}");
        }

    }
}
